SpectraSim Documentation
Parameter · 07 Run Settings

Parallel cores

simulation_control.parallel_cores Unit: cores Step 07 · Run Settings

How many processor cores the flow solver uses. 0 (auto) meshes serially and then gives the solver as many cores as the finished mesh can keep busy, leaving one core free for the computer.

Last updated

Theory

A parallel run splits the mesh into nn subdomains (decomposePar, scotch method) and runs one solver process per subdomain under MPI; neighbouring subdomains exchange their boundary values every iteration (OpenFOAM user guide, 2026). With too few cells per subdomain the exchange dominates and more cores no longer help.

Auto, equation (1): the physical cores minus one (when there are more than two), and no more than one core per 15,000 cells; very small meshes run serially. Hyper-threads are not counted: two threads of one core share its arithmetic units. The count is chosen from the mesh after meshing and written to logs/cores.txt; a continued run keeps the decomposition it was started with.

Meshing is serial with auto. A typed number above 1 also meshes in parallel when this machine's environment check found parallel the mesher to work and the case has no perforated walls or packings; perforated walls and packings always mesh serially (createPatch and topoSet are serial). The solver is parallel whenever n>1n > 1.

Equations

nauto=max⁡ ⁣(1, min⁡ ⁣(ncap, ⌊Ncells15 000⌋)),ncap={nphys−1nphys>2nphysotherwisen_{auto} = \max\!\left(1,\ \min\!\left(n_{cap},\ \left\lfloor \frac{N_{cells}}{15\,000} \right\rfloor\right)\right), \qquad n_{cap} = \begin{cases} n_{phys} - 1 & n_{phys} > 2 \\ n_{phys} & \text{otherwise} \end{cases}
(1)
wheremeaningunit
nauton_{auto}Cores chosen on auto-
NcellsN_{cells}Cells of the finished mesh-
nphysn_{phys}Physical cores of the computer (Windows API, not hyper-threads)-

Default and rule

Default
0 (auto)Computed by the programMeasured
Rule

0 = auto.

Source

Measured on a 4-core / 8-thread laptop, seconds per iteration: 184k cells, 1 core 0.909, 2 cores 0.572, 3 cores 0.516, 4 cores 0.481, 7 processes (one per hyper-thread but one) 0.457; 46k cells, 1 core 0.102, 2 cores 0.065, 3 cores 0.057. Auto therefore picks 3 here: 1.8 times faster than serial with the computer still usable; 7 processes gained only 4 % over 4 cores. Parallel results agree with serial ones (a perforated-plate case gave the same result on 2 cores as serially).

Valid range 0 = auto, or a whole number ≥ 1

Values

0 (auto) or a whole number ≥ 1. More cores than physical cores gains almost nothing.

Parallel meshing

Parallel the mesher crashed on thin, elongated shapes in the verification cases; auto always meshes serially.

References 1

  1. OpenCFD Ltd. (2026). OpenFOAM user guide. openfoam.com. Web page