Time-Dependent Solver
Use the Time-Dependent Solver () to find the solution to time-dependent problems (also called dynamic or unsteady problems) using the implicit time-stepping methods BDF or generalized-α or an explicit method from a family of Runge-Kutta methods for solving ordinary differential equations. This solver is automatically used when a Time Dependent study is added to the model.
Also see About the Time-Dependent Solver for information about The Implicit Time-Dependent Solver Algorithms and BDF vs. Generalized-α and Runge-Kutta Methods.
General
Use the Defined by study step list to specify if the settings are synchronized with the corresponding study step (the default). If you select User defined (to override the settings defined in the corresponding study node), you can specify the following settings:
Use the Time unit list to choose a time unit that is suitable for the time span of the simulation. The default time unit is inherited from the corresponding setting in the study step.
Use the Times field to enter a vector of times that define the time span for the simulation using the Range button () if needed (default: range(0,0.1.1)).
Use the Relative tolerance field to enter a positive scalar number (default: 0.01). The solver uses this number to control the relative error in each time step. The tolerance may need to be set to a smaller (tighter) value if the simulation results seem unexpected or inconsistent.
Absolute Tolerance
See Absolute Tolerance Settings for the Time-Dependent Solver for details about this section.
Specify an absolute tolerance that is used by the solver to control the absolute error. The tolerance specified here is applied to all variables unless modified per variable by selecting a method other than the global method for a variable.
Select a Global method to select how the specified absolute tolerance is to be interpreted for the variables that use the global method (by default, all variables use the global method). Select:
Scaled to let the absolute tolerance be applied to scaled variables.
Unscaled to let the absolute tolerance be applied to unscaled variables.
Select a Tolerance method to specify how to enter and compute the absolute tolerance. Select:
Factor to specify a factor (default: 0.1) in the Tolerance factor field that makes the absolute tolerance proportional to the relative tolerance. With this method, the absolute error does not become dominating when you reduce the relative tolerance so that it is much smaller than the absolute tolerance.
Manual to specify a value for the absolute tolerance. In the Absolute tolerance field, enter a positive number that is applied to either scaled or unscaled variables.
To specify the absolute tolerance individually for a variable, select from the Variables list and modify the corresponding tolerance using the Method list. Select:
Scaled to apply the specified tolerance to scaled variables.
Unscaled to apply the specified tolerance to unscaled variables.
Use global (the default) to apply the tolerance specified for the global tolerance.
If Scaled or Unscaled is selected as the Method:
Enter a Tolerance value to modify the absolute tolerance for the selected variable.
If a problem of wave-equation type is being solved, and if Method in the Time Stepping section is set to BDF, then by default, the solver chooses a tolerance for these components. To manually enter a tolerance for a time derivative when using a first-order time integration method like BDF, select the Tolerance, time derivative check box and enter a tolerance in the associated field. The generalized-α method does not use this tolerance setting.
The Method setting (Scaled or Unscaled) that is selected for a variable applies also to its time derivative.
Select the Update scaled absolute tolerance check box as needed. See Absolute Tolerance Settings for the Time-Dependent Solver for details.
Time Stepping (General Settings)
Select a time-stepping Method. See BDF vs. Generalized-α and Runge-Kutta Methods for details about the implicit methods. Select:
BDF to use a backward differentiation formula.
Runge-Kutta to use an explicit method from the Runge-Kutta family of methods for ODEs. From the Runge-Kutta method choose one of the following time-stepping methods:
-
RK34 (the default) combines adaptivity with good stability properties along the imaginary axis. It is therefore suitable for oscillatory problems.
-
Cash-Karp 5 is similar to Dormand-Prince 5 but has an even larger stability region along the negative real axis. It is therefore more efficient for naturally damped problems.
-
Dormand-Prince 5 (DOPRI5) method (see Ref. 13) provides estimates of the accuracy and stability by combining the Runge-Kutta steps using different sets of coefficients to get different order of accuracies.
The Runge-Kutta methods are suitable for nonstiff problems. They do not support DAEs, and it is also not possible to combine them with events or with sensitivity analysis.
Generalized alpha to use the generalized-α method.
Initialization only to compute consistent initial values only and then stop. If this option is selected, no other settings are required.
Time Stepping (BDF and Generalized Alpha)
The following settings are available when BDF or Generalized alpha is selected above.
If a Fully Coupled or Segregated attribute node is attached to a Time node, the settings for the nonlinear systems solved by the time-stepping methods come from that node.
The time-stepping method Generalized alpha requires a Fully Coupled or Segregated attribute node.
The time-stepping method BDF can be used without a Fully Coupled or Segregated attribute node. In such a situation, the BDF method uses an internal automatic nonlinear solver.
Steps Taken by Solver
To modify how the time-stepping methods select the time steps, choose an option from the Steps taken by solver list. Select:
Free to let the time-stepping method choose time steps freely. The times specified in the Times field in the General section are not considered when a time step is chosen.
Intermediate to force the time-stepping method to take at least one step in each subinterval of the times specified in the Times field in the General section.
Strict to force the time-stepping method to take steps that end at the times specified in the Times field in the General section. The solver takes additional steps in between these times if necessary.
Manual to override the automatic choice of time step with a manual choice. Manual time stepping can be useful in cases where the automatic time-step selection does not work; for example, in contact problems, rotating machinery, or fluid-structure interaction.
Manual is available for BDF and Generalized alpha and overrides the local error estimation made in each time step.
Further options that apply to one or several combinations (as indicated at each bullet) of selections made in the Method and Steps taken by solver lists are:
If Free, Intermediate, or Strict is selected for the Steps taken by solver:
Initial step. By default, the solver chooses an initial step automatically. Select the Initial step check box for manual specification of an initial step. By default, the first step is 0.1% of the end time, which can affect your solution so that you do not get the same time-step history up to a certain earlier time when the end time is changed. This should, however, not change the result appreciably if you use tight enough tolerances for that the automatic time step control. Also, the results of the consistent initialization can be strongly dependent on the initial time step taken, if the initial conditions and the boundary conditions do not match, for example. If needed, you can change the values for the Initial step or the Fraction of initial step for Backward Euler (see below).
Maximum step constraint. By default, the solver chooses a maximum time step automatically. Select Constant as the maximum step constraint for manual specification of a fixed maximum time step. A constant maximum step constraint is a positive scalar value, which can be an expression that evaluates to a numerical value before entering the solver. The expression can include global parameters. Select Expression as the maximum step constraint for more general expressions of the allowed maximum time step. These expressions are evaluated while solving and can, for instance, depend on the time parameter itself.
Additionally, if BDF is selected as the time stepping Method:
Maximum BDF order (available if Free, Intermediate, or Strict is selected for the Steps taken by solver). This setting controls the maximum allowed degree of the interpolating polynomial of the BDF method.
Minimum BDF order (available if Free, Intermediate, or Strict is selected for the Steps taken by solver). This setting can be used to prevent the solver from decreasing the order of the BDF method below 2.
BDF order (available if Manual is selected for the Steps taken by solver). The order of the BDF can be 1–5 (default order: 2).
Initial step fraction (available if Manual is selected for the Steps taken by solver). During the startup of the BDF method, a shorter time step will be used to compensate for the lower order that is used for the first handful of steps. The initial step is a fraction of the first step, and the solver then exponentially increases the step length until the requested step length is reached. This settings and the initial step growth rate below control that startup phase. The default values depend on the selected BDF order.
Initial step growth rate (available if Manual is selected for the Steps taken by solver).
Time step (available if Manual is selected for the Steps taken by solver). Enter a manual time step specification as a scalar, a vector of times, or an expression containing global variables or parameters in the Time step field. The relative and absolute tolerances are still used to terminate the algebraic equations at each time step. Also, the requested time step will be reduced if the algebraic solver does not converge.
Event tolerance. This setting can be used to set the event tolerance (default value: 0.01), which is used for root finding of event conditions when using implicit events; see Explicit Event.
Nonlinear controller. Select this check box to use a nonlinear controller for more efficient time-step control in the BDF method, especially for highly nonlinear problems such as multiphase flow and turbulence in fluid dynamics. When nonlinear failures occur, the nonlinear controller becomes active and uses a more careful time step control. The nonlinear controller acknowledges that the step size for Newton stability might be smaller than the step size for BDF accuracy.
If Generalized alpha is selected as the time stepping Method:
Time step increase delay (available if Free, Intermediate, or Strict is selected for the Steps taken by solver). Select this check box and enter a positive integer in the field to make the solver more restrictive when increasing the time step. This integer is the number of time steps taken by the solver before the increase of the time step is actually performed, from the first step where the error estimator signals that the current step is too small. This setting is useful when there is a natural variation in the solution, like periodicity or quasi-periodicity, which make the time steps vary up and down in size. The generalized-α method does not work well when the time step changes often, so in those situations it is better to damp the changes by a more conservative strategy using this setting. Entering 0 results in the same behavior as clearing the check box.
Time step (available if Manual is selected for the Steps taken by solver). Enter a manual time step specification as a scalar, a vector of times, or an expression containing global variables or parameters in the Time step field.
Amplification for high frequency. Enter a number between 0 and 1 to control how much damping of high frequencies the solver provides. A value close to 0 results in efficient damping, while a number close to 1 results in little damping.
Predictor. Select Linear to use linear extrapolation of the present solution to construct the initial guess for the nonlinear system of equations to be solved at the next time step. Select Constant to use the current solution as initial guess.
Also, the following settings are available for the BDF and generalized-α methods:
Algebraic Variable Settings
Use the Singular mass matrix list to control whether the solver automatically determines if a system includes a differential-algebraic equation or not. Select:
Maybe to make the solver look for zero-filled rows or columns in the mass matrix as a means of detecting a differential-algebraic equation.
Yes if the model includes a differential-algebraic equation where the mass matrix has no zero-filled rows or columns.
Use the Consistent initialization list to control how the solver performs consistent initialization of differential-algebraic systems. The consistent initialization procedure tries to reconcile inconsistent initial values. In doing that, it takes a small time step (by default, 0.1% of the initial step size). If, for example, you have boundary conditions and initial conditions that do not match, the results of the consistent initialization is strongly dependent on the initial time step taken. Select:
Backward Euler (the default) to perform consistent initialization using a small artificial step with the backward Euler method. When this is selected, enter a value in the Fraction of initial step for Backward Euler field. This value is a dimensionless quantity that determines the size of the time step for the backward Euler method (in terms of the initial step). Adjusting this value can improve the accuracy of the initialization step but can also affect the start-up of some models. The default value is 0.001 (that is, the small backward Euler step size is 0.1% of the initial step size).
Off to indicate that the initial values already are consistent, which means that the solver does not modify them.
On to use a consistent initialization routine that is preferable to Backward Euler for index-1 differential-algebraic equations.
The On option is only available when Time method is set to BDF at the same time that the internal nonlinear solver of the BDF method is used.
Use the Error estimation list to control how to treat algebraic degrees of freedom of a differential-algebraic system when estimating the time discretization error. Select:
Include algebraic (the default) to include the algebraic degrees of freedom in the error norm.
Exclude algebraic to exclude the algebraic degrees of freedom from the error norm.
Excluding algebraic degrees of freedom (which stem from stationary equations in the model) means that the algebraic variables are not included in the error test for the time step. The algebraic variables are still solved for as part of the general system of equations. Excluding the algebraic variables from the error test might have the effect that the constraints (including hidden constraints, which are implicitly part of the equations) are not accurately fulfilled. In general, excluding algebraic degrees of freedom is not recommended when solving DAE systems of index 1, whereas it can be generally encouraged for DAE systems of index 2 (see Ref. 6).
If Backward Euler is selected from the Consistent initialization list, select the Rescale after initialization check box if you want to perform an rescaling of the variables. In fluid-flow simulations, for example, the scaling for velocity can be problematic because the velocity is often zero at the start but then changes dramatically after a consistent initialization. Rescaling of the velocity and pressure can provide a smoother start and avoid using very small time steps.
Time Stepping (Runge-Kutta Methods)
The following settings are available when Runge-Kutta is selected as the time-stepping method:
Steps Taken by Solver
To modify how the Runge-Kutta time-stepping methods select the time steps, choose an option from the Steps taken by solver list. Select:
Free to let the time-stepping method choose time steps freely. The times specified in the Times field in the General section are not considered when a time step is chosen.
Intermediate to force the time-stepping method to take at least one step in each subinterval of the times specified in the Times field in the General section.
Strict to force the time-stepping method to take steps that end at the times specified in the Times field in the General section. The solver takes additional steps in between these times if necessary.
Manual to override the automatic choice of time step with a manual choice.
Further options that apply to one or several combinations (as indicated at each bullet) of selections made in the Method and Steps taken by solver lists are:
If Free, Intermediate, or Strict is selected for the Steps taken by solver:
Initial step. By default the solver chooses an initial step automatically. Select the Initial step check box for manual specification of an initial step.
The following settings for Free, Intermediate, and Strict are only available for the Dormand-Prince time-stepping method:
Maximum step. By default the solver chooses a maximum time step automatically. Select the Maximum step check box for manual specification of a maximum time step. The maximum time step is a positive scalar value, which can be an expression that evaluates to a numerical value. The expression can include global parameters.
Minimum step size growth ratio and Maximum step size growth ratio. These growth ratio limits restrict how fast the step size may change, enforcing that the values of the ratio hnew/hold is within the minimum step size growth ratio (default: 0.2) and the maximum step size growth ratio (default: 10).
Step size safety factor. The solver multiplies this factor (default: 0.9) to the estimated largest allowed step size to avoid taking too large step sizes when the estimate overshoots.
PI step controller. This setting affects the behavior of the PI (proportional-integral) controller that adds damping on step size changes to avoid choosing too large steps, which would then be rejected. The default value is Quick, which corresponds to a PI controller that responds quickly to changes. The Smooth option sets the controller to react more slowly, giving smoother choices of time steps. You can also turn off the PI controller by selecting Disabled. This setting affects the parameters α and β in the relation . Here S is the safety factor described above, and erri is the estimated error in step i.
If Manual is selected for the Steps taken by solver:
Time step. Enter a manual time step specification as a scalar, a vector of times, or an expression containing global variables or parameters in the Time step field.
For all options in the Steps taken by solver list, you can also activate or turn off detection of numerical stiffness using the Stiffness detection check box (selected by default). If active, the stiffness detection uses a mechanism to detect if the problem that you solve becomes numerically stiff (which means that an explicit time stepping is required to take very small time steps). If the problem is considered to be stiff, an error appears and the solver stops. You can then switch to another solver that is better suited for stiff problems, such as an implicit BDF method.
Results while Solving
This section mirrors what is defined for the Time Dependent node’s Results While Solving section. That is, changes made to the Time-Dependent node are reflected here.
Output
Use the Times to store list to control at what times the solver stores a solution. Select:
Specified values to store solutions at the values entered in the Times field in the General section.
Steps taken by solver to store solutions at the time steps taken by the solver.
The selection made in the list Steps taken by solver in the Time Stepping section influences the output in this situation.
Select the Store reaction forces check box to compute and store reaction forces in the output. This option is not supported when using any of the Runge-Kutta time-stepping methods.
The computation of boundary flux variables involves solving a system of equations to obtain a continuous field from nodal flux values. If the Use lumping when computing fluxes check box is selected, this system of equations is lumped. The benefits of using this option is that it can avoid certain spurious oscillations in the computed flux field and it is also slightly faster. Lumping is not suitable in 3D for shape functions of order higher than 1. Lumping is not supported when using any of the Runge-Kutta time-stepping methods.
Select the Store time derivatives check box to store time derivatives of the variables solved for in the output. Storing the time derivatives gives more accurate results when evaluating quantities that involve these time derivatives.
Select the Store solution before and after events check box to store two additional solutions every time an implicit or explicit event is triggered. See The Events Interface. This stores the solutions before and after the reinitialization.
Advanced
Select the Allow complex numbers check box to be able to solve problems that are not automatically determined to be complex-valued in a correct way.
Least-Squares Data
Least-squares times are read from files pointed out by the least-squares objective nodes in an Optimization interface. If there is a least-squares objective with a time column, the time values are displayed under Least-squares times from file. If Use least-squares times from file is on (which is the default), the least-squares times are read and merged with the user-defined time list at runtime. The merged data governs the setup of the time-dependent solver.
General parameter values list here refers to the list of times in the General section above. If Exclude times outside General parameter value lists is on (which is the default), start and end simulation times that you have provided are respected when merging with time values from files. Time values from files outside the user-defined time range are ignored. Otherwise (that is, Exclude times outside General parameter value lists is off), all time values from files are used and merged with the user-defined time list.
If Use least-squares times from file is off, no time values from files are used.
You can change the default values of Use least-squares times from file and Exclude times outside General parameter value lists only if Defined by study step is set to User defined.
Constants
In this section you can define constants that can be used as temporary constants in the solver. You can use the constants in the model or to define values for internal solver parameters. These constants overrule any previous definition (for example, from Global Definitions). Some examples of when it can be useful to define constants for a solver:
When you want to define auxiliary parameters that are part of the equations like CFLCMP or niterCMP and where the solver does not define these parameters (niterCMP is defined by the nonlinear solvers).
Click the Add button () to add a constant and then define its name in the Constant name column and its value (a numerical value or parameter expression) in the Constant value column. By default, any defined parameters are first added as the constant names, but you can change the names to define other constants. Click Delete () to remove the selected constant from the list.
Log
This section, which is initially empty, contains a log from the time stepping. This log is stored in the MPH-file. Select the Keep warnings in stored log to keep warning messages in this log so that the information in those warnings is available also when reopening the model.
The Black-Scholes Equation: Application Library path COMSOL_Multiphysics/Equation_Based/black_scholes_put