Tank shape import from CAD

Tank models with complex shape (i.e., shapes imported from CAD) use different options to handle the geometry ("geometry kernels"). This section talks about the recommended options and describes how to use them.

In the ExplicitExternalWithVisualization geometry kernel, the tank liquid level is computed by using external C code. Advantages of this geometry kernel over ModelicaWithVisualization and ExternalWithoutVisualization is that it is computationally faster and avoids implicit equation systems. Thus, the recommended geometry kernel is this one, ExplicitExternalWithVisualization, or its counterpart without visualization, ExplicitExternalWithoutVisualization in case no online result visualization in 3D is of interest.

3D tables

This method uses 3D tables to store level-volume data and heat transfer area data. Inputs to the 3D table are azimuth angle, elevation angle and liquid volume. These tables are generated during the initialization phase. Later during simulation, these table values are interpolated to get correct level and heat transfer areas. Using this method of 3D tables will avoid implicit equation systems in the model. The other methods result in one implicit equation system per tank with imported CAD shape, and are therefore computationally less efficient. A drawback is that interpolation will in general result in some error, which depends on the density of the precomputed data with respect to the independent variables. The more data points are used for interpolation the more accurate the result is.

The dimensions of the 3D table are determined by the parameters noOfVolumePoints and noOfAnglePoints. The default value is 10 x 10. The higher the values of these parameters are, the more table data points are generated and the more accurate the interpolation results become. On the other hand, increasing the number of data points will increase the initialization time.

As the generation of 3D tables takes time during initialization, it is not always desirable to compute them on-the-fly as described above. To save CPU time, these 3D tables can be saved into a mat file once and later can be read from the file. This avoids re-generating identical tables over and over again. Different options for data table handling are shown below.

Online computation

On the recommended geometry kernel, the heat transfer areas can alternatively be computed via a table-free approach (similar to the other, not recommended geometry kernels such as ExternalWithoutVisualization). This method of computation is called online computation of heat transfer areas. In this method, the heat transfer areas are computed online during simulation instead of creating 3D tables and later interpolating from them. This method is more accurate than 3D tables because the difference due to table interpolation is avoided. But this method usually takes more simulation time since a more involved external algorithm is called each time step during simulation. The option to choose between the online computation and table method is shown below. The recommended option is to use the table-based method and precompute all tables into mat files as described above.


Performance comparison

Below graph shows the difference in CPU time between computing table data during initialization and reading table data from file. It is clear that reading from file is much faster. The exact computation time for the tables during initialization depends on geometry complexity (number of vertices and faces, number of data points to be included, and, if heat transfer is active, the number of different heat transfer areas and heat transfer angles).


Below graph shows an exemplary comparison of the liquid level variation between geometry kernels ExternalWithoutVisualization (blue, accurate but slow) and ExplicitExternalWithVisualization (red, nearly as accurate and fast). Despite the ExplicitExternalWithVisualization geometry kernel avoiding implicit equation systems and being computationally efficient, it introduces the shown interpolation error. As the dimensions of the table are increased, the error approaches zero. The figure shows the default dimensions of 10 x 10.