A common mistake when setting up transient models is to have initial conditions that are inconsistent with the loads and boundary conditions. This occurs most often when running transient fluid flow studies, but the same type of issue can occur in any time-dependent model.
You may observe the solver taking very small timesteps at the beginning of the simulation, or the solver will report an error message similar to:
Failed to find consistent initial values.
Last time step is not converged.
To illustrate this issue and its resolutions, consider a simple fluid flow model as diagrammed below. Solve for Laminar Flow of a fluid ( ) in a two-dimensional channel (dimensions 3m x 1m) with an inlet on the left and an outlet on the right. Specify a velocity of 1 m/s at the inlet and a zero-pressure boundary condition at the outlet. The initial values in the channel are left to their default values, i.e., (u,v)=(0,0) and p=0. The corresponding model file can be downloaded here.
These boundary conditions lead to a mismatch between the value of the velocity at the inlet u=1m/s and the value of the velocity inside the channel u=0 m/s at the beginning of the simulation, at the initial values from which the transient solver starts to compute the solution. This is referred to as Inconsistent Initial Values.
COMSOL will, by default, attempt to reconcile inconsistent initial values by taking a small timestep that is a fraction of the initial timestep using a Backward Euler method. By default, the initial timestep is automatically determined based upon the total simulation timespan, but it is possible to manually set the initial timestep and also to change the fraction of that initial step used by the Backward Euler method for the consistent initialization. These settings will affect the results of the consistent initialization procedure. The consistent initialization may fail if the Backward Euler step is too large or the boundary conditions truly are inconsistent. More commonly the results may be very far from what is expected, and the solver will likely need to take very small timesteps at the beginning of the simulation to evolve from this solution. This is undesirable as it leads to relatively long solution times.
The default settings for the initial timestep size and consistent initialization.
In many cases this consistent initialization is not strictly needed and it might be better to turn it off and to ensure that your model smoothly ramps all loads and boundary conditions from consistent initial values. This Knowledgebase presents two ways to do so.
Note, however, that if your boundary conditions truly are inconsistent with each other and the physics, then the resolutions in this Knowledgebase will not apply. Always check carefully the applied loads and boundary conditions for consistency. The recommendations in this Knowledgebase apply to well-posed problems.
Method 1: Initialize the time dependent study with a stationary study
A single Study can include multiple Steps, and by default the results of each step are passed on to the following step as initial values. Adding a stationary step before a transient study step will thus solve first for the fields under the steady-state assumption, and these provide a consistent initial value for the transient step, overriding the initial values specified within the Initial Values feature in the physics interface. As long as the two steps are within the same study, as shown in the screenshot below, no other settings changes are needed. When the study is solved, both steps will be re-computed.
Using a stationary step step to compute initial values for the transient study step.
It is also possible to split the stationary step and the transient step into two different studies. This requires that the Values of Dependent Variables in the transient study are manually set to refer to the results of the stationary study, as shown in the screenshot below. The corresponding model file can be downloaded here.
Adjusting the settings of a time dependent study to use the initial values computed from a stationary study.
This strategy has a few drawbacks, however. First, a stationary solution might not exist at all. This is particularly common for fluid flow models near the onset of turbulence, where steady boundary conditions result in an unsteady (time-varying) flow field. It can also be that a steady state solution is quite numerically difficult to find, see Knowledgebase 103: Improving Convergence of Nonlinear Stationary Models for how to address such cases. Second, the objective of the transient model may be to investigate the startup behavior, as the system evolves from the at-rest state. In either case, use the second method, described below.
Method 2: Ramp up the boundary conditions over time
The loads and boundary conditions on a transient model can be ramped up from values that are consistent with the initial values. The most common case would be an at-equilibrium system, where the initial values are zero everywhere. Use the built-in Step function with smoothing, as shown in the screenshot below. There several other built-in functions that also include a Smoothing option, as described in Knowledgebase 905: Modeling of step transitions. These all, by default, will have a time-derivative equal to zero at the start of the smoothing zone, which is helpful.
The settings of the Step function with smoothing.
Use this smoothed step function to modify the loads and boundary conditions, as shown in the screenshot below. The corresponding model file can be downloaded here.
The smoothed step function is used to ramp the boundary condition.
You will need to choose a timespan for the smoothing that is physically realistic for the the problem at hand. For example, in the case of laminar fluid flow, you should not ramp the velocity so quickly as to introduce a supersonic shock. Or, for an electromagnetic wave problem, do not introduce a ramping that is faster than the speed of light. See also Knowledgebase 1244: Solving Wave-Type Problems with Step Changes in the Loads. It can also instead be reasonable to introduce a very gradual ramping, depending upon your desired model outputs.
Note that not all problems will require this type of smoothing. Some problems, particularly heat transfer problems that do not involve convection, can be solved with step changes in the loads. If these step changes happen during the simulation time-span you should use Events to accurately model these cases, as described in Knowledgebase 1245: Solving Models with Pulsed Loads in Time.
Once either of the above techniques is implemented, the issue of consistent initialization should be resolved, and you should not have to alter the study settings.
If you do continue to have issues with convergence, it can be that your model is not meshed finely enough, in which case you should perform a mesh refinement study as described in Knowledgebase 1261: Performing a Mesh Refinement Study. It can also be that your model is highly nonlinear, in which case see Knowledgebase 1127: Improving convergence in nonlinear time dependent models.
Pesquise por CategoriaMensagens de Erro (64)
Mecânica Estrutural (3)
Dinâmica dos Fluidos (1)
ALE / Geometria Parametrizada (1)
Informação do Produto (2)
Modelos de Usuários (1)
COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.