RunFileLAMMPS#
Description#
RunFileLAMMPS (registered sub-model keywords: runFileLAMMPS, runLAMMPSFile) is a LAMMPS Command Models sub-model used in coupled CFD-DEM simulations.
Category: LAMMPS Command Models
Registered Keywords:
runFileLAMMPS,runLAMMPSFileApplicable Solvers: Both resolved and unresolved solvers (e.g., resolvedDiffuseInterfaceLAMMPSFoam, unresolvedDiffuseInterfaceLAMMPSFoam)
Executes arbitrary LAMMPS/WASHLIGGGHTS commands from an external script file during each coupling cycle.
Unlike the default RunLAMMPS model—which issues a standard run <couplingInterval> command—RunFileLAMMPS allows users to execute custom commands, diagnostics, dumps, fixes, or adaptive subcycling at every coupling exchange.
Exported Coupling Interval Variable#
Before executing the command file during each coupling cycle, RunFileLAMMPS exports an equal-style variable to LAMMPS:
variable couplingInterval equal <couplingInterval>
This enables the script file to dynamically access the coupling interval defined in OpenFOAM’s couplingControlModel (such as StandardControl) using ${couplingInterval} (or $couplingInterval).
Simulation Time Synchronization#
During each coupling cycle:
The current LAMMPS time step \(N_{\text{step},0}\) is recorded before script execution.
The command file is executed in LAMMPS.
The elapsed time steps \(\Delta N = N_{\text{step}} - N_{\text{step},0}\) are evaluated:
If \(\Delta N > 0\): \(\Delta t = \Delta N \times \Delta t_{\text{DEM}}\)
If \(\Delta N \le 0\): \(\Delta t = N_c \times \Delta t_{\text{DEM}}\) (where \(N_c\) is the configured
couplingInterval)
The OpenFOAM elapsed DEM time (
LAMMPSElapseTime) and coupling duration (couplingT) are updated by \(\Delta t\).
File Path Resolution#
The file specified by the file parameter is resolved using the following search order:
Absolute path: If the path starts with
/or expands to an absolute path.Case LAMMPS directory:
<case>/LAMMPS/<file>(standard WashOpenFOAM convention).Case root directory:
<case>/<file>.Current time directory:
<case>/<time>/<file>.Current working directory:
<file>.
If the file cannot be located, the simulation terminates with a fatal error indicating the resolved path.
Configuration#
To configure runFileLAMMPS, specify the model keyword and sub-dictionary under LAMMPSCommandModels in constant/kinematicCloudProperties or constant/solidProperties:
LAMMPSCommandModels
{
runFileLAMMPS
{
file "in.liggghts_run";
}
}
It can also be combined with other command models:
LAMMPSCommandModels
{
runFileLAMMPS
{
file "in.liggghts_run";
}
writeRestartLAMMPS;
}
Parameters#
file(string / fileName): Path or name of the LAMMPS/WASHLIGGGHTS command file to execute during each coupling cycle. Recognized synonyms includefileName,commandFile, andcommandsFile.
Example Command Script#
Example of a coupling script (e.g., LAMMPS/in.liggghts_run):
# Advance DEM simulation using the exported coupling interval
run ${couplingInterval}