Skip to content

Input File Reference

All simulation parameters are defined in code_base/inputfile/input_param.txt. The file uses Fortran namelist format.

File Structure

The input file has two sections:

  1. Geometry block (free-format, line-by-line)
  2. Namelist blocks (&name ... / format)

Geometry Parameters

The geometry is defined by zones in each direction. Each zone has a length, number of control volumes, and power-law exponent for grid stretching.

nzx                          ! number of x-zones (max 7)
xzone(1), xzone(2), ...     ! length of each zone (m)
ncvx(1), ncvx(2), ...       ! number of CVs in each zone
powrx(1), powrx(2), ...     ! power-law exponents (1=uniform, >1=cluster at end, <0=cluster at start)

Same pattern repeated for y (nzy) and z (nzz).

Example (current setup):

Direction Zones Lengths CVs Exponents Total
x 1 4.0 mm 400 1 (uniform) 400 cells
y 1 4.0 mm 400 1 (uniform) 400 cells
z 2 0.5 mm + 0.2 mm 10 + 40 -1.5, 1 50 cells

The z-direction uses two zones: a substrate zone (0.5 mm, coarse, clustered toward top) and a powder/build zone (0.2 mm, fine, uniform). Total domain: 4 mm x 4 mm x 0.7 mm.

Grid Stretching

Power-law exponent controls cell clustering:

  • powr = 1: uniform spacing
  • powr > 1: cells cluster toward the end of the zone
  • powr < 0: cells cluster toward the start of the zone (e.g., -1.5 clusters z-cells toward the substrate-powder interface)

Namelist Blocks

&process_parameters — Surface Laser Source

Parameter Unit Description
alaspow W Surface laser power (set to 0 when using volumetric source)
alaseta - Surface laser absorption efficiency
alasrb m Laser beam radius (1/e^2)
alasfact - Gaussian factor (typically 2 for 1/e^2 definition)

&volumetric_parameters — Volumetric Heat Source

Parameter Unit Description
alaspowvol W Volumetric laser power
alasetavol - Volumetric absorption efficiency
sourcerad m Source radius (Gaussian 1/e^2)
sourcedepth m Source penetration depth

Note

Either surface (alaspow) or volumetric (alaspowvol) source is used. Set the unused one to 0. The volumetric source distributes heat as:

\[q(x,y,z) = \frac{P \cdot \eta \cdot f}{\pi r_s^2 \cdot d_s} \exp\left(-\frac{f}{r_s^2}\left[(x-x_b)^2 + (y-y_b)^2\right]\right)\]

&material_properties — Primary Material (C=1)

Parameter Unit Description Example
dens kg/m^3 Solid density 8440
denl kg/m^3 Liquid density 7640
viscos Pa*s Dynamic viscosity (liquid) 0.007
tsolid K Solidus temperature 1563
tliquid K Liquidus temperature 1623
tboiling K Boiling/vaporization temperature 2650
hlatnt J/kg Latent heat of fusion 290000
acpa J/(kg*K^2) Solid specific heat coefficient (quadratic term) 0.2441
acpb J/(kg*K) Solid specific heat coefficient (linear term) 338.59
acpl J/(kg*K) Liquid specific heat (constant) 709.25
thconsa W/(m*K^2) Solid thermal conductivity coefficient (linear term) 0.0155
thconsb W/(m*K) Solid thermal conductivity coefficient (constant term) 5.0435
thconl W/(m*K) Liquid thermal conductivity (constant) 30.078
beta 1/K Thermal expansion coefficient (for buoyancy) 5e-5
emiss - Surface emissivity (for radiative loss) 0.3
dgdtp N/(m*K) dg/dT — thermal Marangoni coefficient -3.8e-4

Specific Heat Model

Solid specific heat is temperature-dependent: \(c_p(T) = a \cdot T + b\) where acpa = \(a\), acpb = \(b\). The enthalpy-temperature curve is:

  • Solid (\(T \leq T_s\)): \(H = \frac{a}{2}T^2 + bT\)
  • Mushy (\(T_s < T < T_l\)): linear interpolation between \(H_s\) and \(H_l\)
  • Liquid (\(T \geq T_l\)): \(H = H_l + c_{p,l}(T - T_l)\)

&powder_properties — Powder Layer

Parameter Unit Description Example
layerheight m Powder layer thickness 0.04e-3
pden kg/m^3 Powder density (accounts for porosity) 4330
pcpa J/(kg*K^2) Powder specific heat (quadratic) 0.2508
pcpb J/(kg*K) Powder specific heat (linear) 357.7
pthcona W/(m*K^2) Powder conductivity (linear) 0
pthconb W/(m*K) Powder conductivity (constant) 0.995

Powder properties apply to cells in the top layerheight of the domain that have not yet been melted (solidfield <= 0.5).

&numerical_relax — Solver Parameters

Parameter Unit Description Example
maxit - Max iterations per time step 60
delt s Time step size 2e-5
timax s Total simulation time 0.09
urfu - Under-relaxation factor for u-velocity 0.7
urfv - Under-relaxation factor for v-velocity 0.7
urfw - Under-relaxation factor for w-velocity 0.7
urfp - Under-relaxation factor for pressure 0.7
urfh - Under-relaxation factor for enthalpy 0.7

&boundary_conditions — Thermal Boundaries

Parameter Unit Description Example
htci W/(m^2*K) Convection coefficient on x-faces (west/east) 5
htcj W/(m^2*K) Convection coefficient on y-faces (north/south) 5
htck1 W/(m^2*K) Convection coefficient on bottom face 5
htckn W/(m^2*K) Convection coefficient on top face 5
tempWest K Far-field temperature at west boundary 293
tempEast K Far-field temperature at east boundary 293
tempNorth K Far-field temperature at north boundary 293
tempBottom K Far-field temperature at bottom boundary 293
tempPreheat K Initial/preheat temperature 293
tempAmb K Ambient temperature (for radiation) 293

The top surface uses combined convection + radiation: $\(q_{loss} = h(T - T_{amb}) + \epsilon \sigma (T^4 - T_{amb}^4)\)$

&output_control — Output Settings

Parameter Unit Description Example
outputintervel steps VTK output frequency (every N time steps) 50
case_name - Case identifier (sets output directory name) 'testcase'
toolpath_file - Path to toolpath file (.crs) './ToolFiles/B26.crs'
species_flag - Enable species transport (0=off, 1=on). When 1, secondary-material properties are read from solver_species/inputfile/input_param_species.txt 0
predict_flag - Enable field prediction by integer-cell shift (0=off, 1=on) 0

When predict_flag=1, the solver shifts enthalpy, velocity, and pressure fields by an integer number of cells in the scan direction before entering the iteration loop on heating steps (laser on, melt pool present). This provides a better initial guess and reduces iterations by approximately 38% during heating.

&adaptive_mesh — Adaptive Mesh

Parameter Type Description Default
adaptive_flag integer (0 or 1) Enable adaptive mesh 0
amr_dx_fine real (m) Uniform fine-zone cell size 10.0e-6
amr_init_half real (m) Half-width of the initial fine-zone square (centred on the first laser-on waypoint) 50.0e-6
amr_buffer_ratio real Fine-zone half-extent / pool half-extent on each side. ≥ 1.0; pick > 1.2 to keep the bbox out of the geometric coarse ring 1.5
amr_growth_ratio real Geometric growth factor per coarse cell outside the fine zone 1.15
amr_max_cell real (m) Cap on coarse cell size; warning if exceeded 1.0e-4
amr_max_ncv integer Hard cap on per-axis interior cells (drives X/Y allocation) 250
remesh_interval integer Regrid every N timesteps 20

Behaviour when adaptive_flag=1:

  • The top-of-file X/Y zone block is ignored. ncvx(1) / ncvy(1) are overridden to amr_max_ncv at startup so the field arrays are sized for the worst case. The Z block always applies (Z is never remeshed).
  • Initial fine zone is a 2 × amr_init_half square centred on the first toolpath row with laser_on ≥ threshold.
  • After every remesh_interval steps, the asymmetric fine-zone half-extents become max(amr_init_half, alen_{tail|head|lo|hi} × amr_buffer_ratio) (clamped to the domain). This tracks the long-tail / short-head shape of moving-laser pools without truncating either side.
  • Outside the fine zone, coarse cells grow geometrically at amr_growth_ratio per cell. If a cell exceeds amr_max_cell the writer emits one [amr] WARNING line per remesh; consider raising amr_max_ncv or shrinking the domain.

Tuning notes. With amr_dx_fine = 10 μm, amr_max_ncv = 250, and a 2 mm domain, a steady-state pool of 800 μm × 200 μm is comfortably inside the fine zone with amr_buffer_ratio = 1.5. Drop amr_buffer_ratio to ~1.05 only if the CA-coupling writer's clip warning is silent — otherwise the bbox lands in the geometric coarse ring and assert_axis_uniform aborts.

&mechanical_params — Mechanical Solver

Parameter Type Description Default
mechanical_flag integer (0 or 1) Enable mechanical solver 0
mech_interval integer Solve mechanical every N thermal steps 10
mech_output_interval integer Write mechanical VTK every N mechanical solves 5
mech_mesh_ratio integer FEM grid coarsening ratio vs thermal grid 2

When mechanical_flag=1, the EBE FEM solver computes residual stress and deformation from the thermal field. The FEM grid is coarsened from the thermal grid by mech_mesh_ratio (e.g., 200x200 thermal with ratio=2 gives 100x100 FEM nodes).

Parallel mode: use bash run.sh <case> <thermal_threads> <mech_threads> to run thermal and mechanical as separate processes. See Mechanical Solver for details.