  When modeling microstructures, the computational resource requirements
increase rapidly as the simulation domain becomes larger. As a result,
simulating a small representative fraction under periodic boundary conditions
is often a necessary simplification. However, the truncated structures leave
nonphysical boundaries, which are detrimental to numerical modeling. Here, we
propose a self-stitching algorithm for generating periodic structures,
demonstrated in a grain structure. The main idea of our algorithm is to
artificially add structural information between mismatched boundary pairs,
using the hierarchical spatial predictions of the U-Net. The algorithm provides
an automatic and unbiased way to obtain periodic boundaries in grain structures
and can be applied to porous microstructures in a similar way.
