LaserbeamFoam
Laser Ray Tracing Implementation and fluid flow simulation framework for Additive Manufacturing, laser welding, laser drilling applications
Install / Use
/learn @laserbeamfoam/LaserbeamFoamREADME
laserbeamFoam solvers
<p align="center">
<img src="images/LBF.gif" alt="LBF gif" style="width:1000px;">
</p>
Overview
Presented here is a growing suite of solvers that describe the laser-substrate
interaction. This repository begins with the laserbeamFoam solver. Additional
solvers are being added incrementally.
Currently, this repository contains two solvers:
laserbeamFoam
A volume-of-fluid (VOF) solver for studying high-energy-density laser-based advanced manufacturing processes and laser-substrate interactions. This implementation treats the metallic substrate and shielding gas phase as in-compressible. The solver fully captures the metallic substrate's fusion/melting state transition. For the vapourisation of the substrate, the explicit volumetric dilation due to the vapourisation state transition is neglected; instead, a phenomenological recoil pressure term is used to capture the contribution to the momentum and energy fields due to vaporisation events. laserbeamFoam also captures surface tension effects, the temperature dependence of surface tension (Marangoni) effects, latent heat effects due to melting/fusion (and vapourisation), buoyancy effects due to the thermal expansion of the phases using a Boussinesq approximation, and momentum damping due to solidification. A ray-tracing algorithm is implemented that permits the incident Gaussian laser beam to be discretised into several 'Rays' based on the computational grid resolution. The 'Rays' of this incident laser beam are then tracked through the domain through their multiple reflections, with the energy deposited by each ray determined through the Fresnel equations. The solver approach is extended from the adiabatic two-phase interFoam code developed by OpenCFD Ltd. to include non-isothermal state transition physics and ray-tracing heat source application.
compressiblelaserbeamFoam
An extension of the laserbeamfoam solver to multi-component metallic
substrates. This solver can simulate (2N+1)-component systems systems where the 2N is because N-components can exist in the domain in their condensed and vapourised states and the mass transfer and volumetric dilation between these states is fully captured. Diffusion is treated through a Fickian diffusion model
with the diffusivity specified through 'diffusion pairs', and the interface
compression is again specified pair-wise. The miscible phases in the simulation
should have diffusivity specified between them, and immiscible phase pairs
should have an interface compression term specified between them (typically 1).
Target applications for the solvers included in this repository include:
- Laser Welding
- Laser Drilling
- Laser Powder Bed Fusion
- Selective Laser Melting
Installation
The OpenFoam_com_main branch compiles with openfoam v2506, while the Openfoam_org_main branch compiles
with OpenFOAM10. To install the laserbeamFoam solvers, first, install and
load a compatible version of OpenFOAM, then clone and build the laserbeamFoam
library:
https://github.com/laserbeamfoam/LaserbeamFoam.git
cd LaserbeamFoam && ./Allwmake -j
where the -j option uses all CPU cores available for building.
The installation can be tested using the tutorial cases described below.
Optional: Installation of the LIGGGHTS® Discrete Element Model Solver
Some of the tutorial cases use a discrete element method (DEM) solver called
LIGGGHTS to simulate the creation of a powder bed, e.g. see this powder bed
fusion tutorial.
For these cases, if available, the liggghts executable will be used in the
case pre-processing process.
On Linux, LIGGGHTS® can be installed with
# Install required dependencies
sudo apt update
sudo apt install -y build-essential cmake gfortran git \
libfftw3-dev libjpeg-dev libpng-dev libvtk6-dev \
libopenmpi-dev openmpi-bin
# Clone the LIGGGHTS repository
git clone https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git
cd LIGGGHTS-PUBLIC/src
# Compile
make auto
# The `liggghts` executable should now be available in this directory
While on macOS, LIGGGHTS® can be installed with
# Install required dependencies using Homebrew
brew install cmake gcc openmpi vtk
# Clone the LIGGGHTS repository
git clone https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git
# Compile
# You may need to update the vtk version in the cmake command to the version
# installed on your system (i.e., replace 9.4.2_1 with another version)
cd LIGGGHTS-PUBLIC
mkdir build
cd build
cmake ../src -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DVTK_DIR=/opt/homebrew/Cellar/vtk/9.4.2_1/lib/cmake/vtk-9.4
make
# The `liggghts` executable should now be available in this directory
For convenience, you can add add liggghts to your PATH (e.g. in ~/.bashrc):
export PATH="~/LIGGGHTS-PUBLIC/build:$PATH"
where the location should be updated to match the location on your system.
Tutorial Cases
The tutorial cases can be run with the included Allrun scripts, i.e.
./Allrun
The Allrun script prepares the mesh and fields, and runs the solver. Typically
the following steps are performed:
# Create the 0 directory
cp -r initial 0
# Create the mesh
blockMesh
# Set the initial fields
setFields
# Run the solver in serial
laserbeamFoam
# Or run the solver in parallel, e.g. on 6 cores
#decomposePar
#mpirun -np 6 laserbeamFoam -parallel &> log.laserbeamFoam
Cases can be cleaned and reset using the included Allclean scripts, i.e.
./Allclean
Algorithm
Initially, the solver loads the mesh, reads in fields and boundary conditions, and selects the turbulence model (if specified). The main solver loop is then initiated. First, the time step is dynamically modified to ensure numerical stability. Next, the two-phase fluid mixture properties and turbulence quantities are updated. The discretised phase-fraction equation is then solved for a user-defined number of subtime steps (typically 3) using the multidimensional universal limiter with explicit solution solver MULES. This solver is included in the OpenFOAM library and performs conservative solutions of hyperbolic convective transport equations with defined bounds (0 and 1 for $α_1$). Once the updated phase field is obtained, the program enters the pressure–velocity loop, where p and u are corrected alternatingly. $T$ is also solved in this loop, so that the buoyancy predictions are correct for the $U$ and $p$ fields. Correcting the pressure and velocity fields in the sequence is known as pressure implicit with the splitting of operators (PISO). In the OpenFOAM environment, PISO is repeated for multiple iterations at each time step. This process is called the merged PISO- semi-implicit method for pressure-linked equations (SIMPLE) or the pressure-velocity loop (PIMPLE) process, where SIMPLE is an iterative pressure–velocity solution algorithm. PIMPLE continues for a user-specified number of iterations.
The main solver loop iterates until program termination. A summary of the simulation algorithm is presented below:
-
laserbeamFoamSimulation Algorithm Summary:-
Initialise simulation data and mesh
-
WHILE $t < t_{\text{end}}$ DO
-
Update $\Delta t$ for stability
-
Phase equation sub-cycle
-
Update interface location for the heat source application
-
Update fluid properties
-
Ray-tracing for Heat Source application at the surface
-
PISO Loop
-
Form $U$ equation
-
Energy Transport Loop
- Solve $T$ equation
- Update fluid fraction field
- Re-evaluate source terms due to latent heat
-
PISO
- Obtain and correct face fluxes
- Solve $p$ Poisson equation
- Correct $U$
-
-
Write fields
-
-
There are no constraints on how the computational domain is discretised.
Visualising the rays in ParaView
laserbeamFoam writes the individual ray beams to VTK/rays_<LASER_NAME>_<TIME>.vtk,
where <LASER_NAME> is the laser's name within the laser sub-dict of constant/LaserProperties
and <TIME> is the time value. ParaView recognises that these files are in a
sequence, so they can all be loaded together: File -> Open... -> Select
rays_..vtk. As the VTK files do not store time-step information, by default,
ParaView assumes the time-step size for the rays is 1 s; however, you can use
the ParaView “Temporal Shift Scale” filter on the rays object to sync the ray
time with the OpenFOAM model time, where the OpenFOAM time-step value (e.g.
1e-5) is used as the Scale. For convenience, a VTK/rays_<LASER_NAME>.vtk.series
files is written at the end of the simulation. This .vtk.series file can be
opened directly in ParaView, which loads the VTK files at the correct physical
times (no need for the “Temporal Shift Scale” filter). Once the ray VTKs are
loaded, they can be viewed by setting their colour appropriately (e.g. to
black); in addition, it is often convenient to increase the "Line Width" or
use the "Tube" filter.
License
OpenFOAM, and by extension, the laserbeamFoam application, is licensed free
and open source only under the GNU General Public Licence version 3.
One reason for OpenFOAM’s popularity is that its users are granted the freedom
to modify and redistribute the software and have a right to continued free use
within the terms of the GPL.
Acknowledgements
Tom Flint and Joe Robson thank the EPSRC for financial support through the associated programme grant LightFORM (EP/R001715/1). Joe Robson thanks the Royal Academy of Engineering/DSTL for funding through the RAEng/DSTL Chair in Alloys for Extreme Environments.
Philip Cardiff and Gowthaman Pariv
