Build & Run¶
Requirements¶
- Compiler: gfortran (GCC Fortran) with OpenMP support
- Python 3: For toolpath generation and thermal history plotting (
numpy,matplotlib) - ParaView: For VTK visualization (optional)
Install dependencies¶
A helper script is provided that installs everything above on common Linux distributions (apt / dnf / yum / pacman / zypper). It auto-detects the package manager, skips anything already installed, and verifies the toolchain (including a small OpenMP compile test):
cd code_base
bash install_deps.sh
The script installs:
gfortranandlibgomp(OpenMP runtime)python3andpipnumpyandmatplotlib(skipped if already importable, e.g. via pip)
Build¶
cd code_base
bash compile.sh
Fortran sources compile with -fopenmp -O3 -march=native and link into compile_files/cluster_main. All artifacts live under compile_files/.
Run¶
bash run.sh <case_name> [thermal_threads] [mech_threads] [ca_threads] &
| Argument | Description | Default |
|---|---|---|
case_name |
Name for this run (creates result/<case_name>/ directory) |
Required |
thermal_threads |
OpenMP threads for thermal-fluid solver | 4 |
mech_threads |
OpenMP threads for mechanical solver (0 = serial in-loop) |
0 |
ca_threads |
OpenMP threads for CA solver (0 = CA disabled) |
0 |
The script updates case_name in input_param.txt, sets OMP_NUM_THREADS, and dispatches each solver according to its flag (mechanical_flag, CA_flag) in the input file. Pass 0 for threads of any disabled solver (a warning prints on mismatch).
Examples:
bash run.sh baseline 4 0 0 & # thermal only
bash run.sh baseline 10 10 0 & # thermal + mechanical
bash run.sh baseline 10 0 8 & # thermal + CA
bash run.sh baseline 10 10 8 & # all three
Monitor¶
# Watch thermal output in real-time
tail -f result/mycase/thermal_fluid_results/mycase_output.txt
# Check progress
grep "progress" result/mycase/thermal_fluid_results/mycase_output.txt | tail -1
Stop¶
# Stop all running simulations
kill $(pgrep -f cluster_main)
# Stop a specific run
ps aux | grep cluster_main # Find PID
kill <PID>
Clean¶
bash clean.sh # Removes compile_files/ and result/<case>/ dirs
Workflow¶
bash install_deps.sh(first time only — installs the full toolchain)- Edit
inputfile/input_param.txt(geometry, materials, numerics, flags) - Generate or select a toolpath in
ToolFiles/ bash compile.shbash run.sh mycase 10 10 8 &- Open VTK files in ParaView:
result/mycase/thermal_fluid_results/mycase_vtkmov*.vtk,result/mycase/mechanical_results/mycase_mech_*.vtk,result/mycase/CA_results/scan_grain/grainsTimeStates/Grains_*.vtk