General informations
Introduction
During a finite element solving, several steps may be achieved in parallel (using several cores available on the machine) such as the building of the topological matrix, the assembly and the solving of the linear system, which usually is the most time-consuming task.
All the steps described above directly depend on the number of nodes in the Flux meshed project. An optimal number of cores usually exists and allows to divide the computations among the different cores without spending too much time on the synchronization between them. This optimal number of cores reduces the calculation times as much as possible, without overloading the machine used.
- Number of cores to use for finite element resolution
- Solver for the resolution of the linear system (direct or iterative)
This document uses 2D, 3D and Skew examples to give recommendations in terms of number of cores and linear solver and an estimation of the memory needed. To do this, a case has been selected for each application (Transient Magnetic, Steady-State AC magnetic and Magnetostatic), this case is solved several times with a different mesh, a different number of cores, from 1 to 32, and different solvers (direct or iterative).
Define the number of cores during solving
In Flux, the number of cores is defined in the Supervisor as shown below and allows, as seen previously, to perform certain finite element solving tasks in parallel.
The figure above shows that the number of cores available on the machine is 16 and each instance of Flux will use 4 of them.
It is also important to note that the computation speed according to the number of cores does not decrease linearly, therefore setting this number to the maximum is not necessarily the best choice and may overload the machine. Moreover, when the number of nodes in the project is not large enough, increasing the number of cores will not allow to reduce the computation time.
Available solvers to solve the linear system
The direct solver is very efficient and requires less memory on small finite element problems like 2D, Skew or even 3D but with a coarse mesh. However, like any direct solver, when the linear system to solve becomes too large, the memory consumption increases drastically and the performances in terms of computation time decrease. As soon as the linear system becomes too large, the use of an iterative solver is recommended. The direct solver used by Flux is MUMPS, for more information on this solver, see the MUMPS page.
The parallel iterative solver uses MPI to parallelize large finite element problems with the advantage of significantly reducing memory requirements compared to direct solver. This solver makes it possible to take advantage of all CPU resources of all computers, laptops or HPC nodes because of its low memory requirements. The iterative solver used by Flux uses PETSc library, for more information, see the PETSc page.
Flux will automatically choose the solver that suits the best once the solving process starts. But, if necessary, a solver can be explicitly set. In Flux, the solver’s choice is in the Solving options and allows to choose the type of solver that will be used during the finite element solving.
- In the menu Solving, select Solving option and click on Edit
- In the window of the Solving options, select the tab Linear system solver
- Then, in the under-tab General, select the type of solver used for the main solving and the pre-computations, the user has the choice between Direct (MUMPS) or Iterative (PETSc).