Choosing parameters¶
nanofoams.check(params) (and every nanofoams generate
run) warns about the situations below.

The two parameters that shape the structure are the solid fraction and \(H^2\):
\(\phi_B\) sets how much is solid and how connected it is, and \(H^2\) sets how
many ligaments fit in one period. The figure is produced by
docs/scripts/make_figures.py.
Solid fraction and percolation¶
Both phases percolate for \(0.159 < \phi_B < 0.841\). Outside that range you get isolated solid clusters (low \(\phi_B\)) or isolated pores (high \(\phi_B\)). Near the threshold the network is fragile and very sensitive to the realisation.
Number of directions and isotropy¶
The length scale is set by \(H^2\), and each \(H^2\) has a fixed set of
directions. Few directions give a visibly anisotropic structure: in the
thesis, foams with \(H^2 = 54\) (48 directions) showed clearly different
stress-strain curves along \(x\), \(y\) and \(z\), while \(H^2 = 161\) (96
directions) behaved much more isotropically. nanofoams warns below 48
directions, and from_ligament_diameter only considers \(H^2\) with at least
min_directions (default 48) directions.
Use nanofoams directions H2 to see how many directions an \(H^2\) has, and
nanofoams suggest-h2 to compare candidates.
Ligament diameter¶
The diameter is set by the box (period) and \(H\): \(L = (a/H)(0.53\phi_B + 0.41)\). Because \(H^2\) is an integer and must have enough directions, not every target diameter is reachable for a given box. For example, \(L = 50.2\) in a 330.3 box at \(\phi_B = 0.3\) needs \(H^2 \approx 14\), which has only 24 directions; with at least 48 directions the closest diameter is 29.4. Options: accept fewer directions, or change the box size.
Two more limits:
- Representative volume: keep \(L / L_\text{box} < 0.1\). Larger ligaments leave too few of them in the box.
- Resolution: ligaments narrower than a few lattice parameters contain only
a handful of atoms across.
nanofoamswarns below \(4 a_0\).
Fluctuations between realisations¶
With finitely many directions, the field of one realisation does not have
exactly unit variance: each direction contributes a random amplitude, and the
spatial variance fluctuates by roughly \(1/\sqrt{n_\text{dir}}\), about 15 % for
\(H^2 = 54\). As a consequence the measured solid fraction and surface area
of a single sample scatter around the predicted values, more so in small boxes
with few directions. Report the measured value
(foam.measured_solid_fraction) and, for statistics, average over several seeds.
Number of waves¶
n_waves is rounded down to a multiple of the number of directions. Thanks to
the exact phase collapse (see Backends) the cost of the default
backend does not depend on n_waves, so there is no reason to keep it small;
the default of 10 000 follows Soyarslan et al.