  Accurate simulation of the printing process is essential for improving print
quality, reducing waste, and optimizing the printing parameters of
extrusion-based additive manufacturing. Traditional additive manufacturing
simulations are very compute-intensive and are not scalable to simulate even
moderately-sized geometries. In this paper, we propose a general framework for
creating a digital twin of the dynamic printing process by performing physics
simulations with the intermediate print geometries. Our framework takes a
general extrusion-based additive manufacturing G-code, generates an
analysis-suitable voxelized geometry representation from the print schedule,
and performs physics-based (transient thermal and phase change) simulations of
the printing process. Our approach leverages parallel adaptive octree meshes
for both voxelated geometry representation as well as for fast simulations to
address real-time predictions. We demonstrate the effectiveness of our method
by simulating the printing of complex geometries at high voxel resolutions with
both sparse and dense infills. Our results show that this approach scales to
high voxel resolutions and can predict the transient heat distribution as the
print progresses. This work lays the computational and algorithmic foundations
for building real-time digital twins and performing rapid virtual print
sequence exploration to improve print quality and further reduce material
waste.
