How to find where and when events happened: an application of event reduction on heat transfer algorithms.
Discrete events generally cause simulation to slow down because a solver will have to reinitialise the state variables via a number of iterations before a feasible numerical solution is reached. As the system becomes larger the iteration steps are likely to increase. When simulating a model a summary on the number of events occurred is reported in a logfile at the end of the simulation. To find out when and where these events are happed a user can open the Simulation Setup window and check Events during simulation under Debug tab. With this setting the log file produced will list all the events that have occurred in a particular subsystem at a particular time instant. For example, the last paragraph of figure 1 shows an event being generated relating to the expression intakePort.m_flow2 + exhaustPort.m_flow2 > 0 at time 0.018909s.
Figure 1: log file that shows where and when an event has happened.
A further inspection of the whole model shows this condition is in the calculation of the in-cylinder heat transfer coefficient using Woschni method. In order to remove this event an alternative method developed by Hohenberg is implemented that approximates the heat transfer coefficient without using events and without a significant loss of accuracy. Since prediction of heat transfer coefficient can be adjusted by using simple tuning parameter and only has a small effect on engine performance prediction, we are able to eliminate an event occurring every cycle for each cylinder with a minimum cost of accuracy.
Written by: Xiaoran Han – Project Engineer