RunFileLAMMPS#

Description#

RunFileLAMMPS (registered sub-model keywords: runFileLAMMPS, runLAMMPSFile) is a LAMMPS Command Models sub-model used in coupled CFD-DEM simulations.

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:

  1. The current LAMMPS time step \(N_{\text{step},0}\) is recorded before script execution.

  2. The command file is executed in LAMMPS.

  3. 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)

  4. 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:

  1. Absolute path: If the path starts with / or expands to an absolute path.

  2. Case LAMMPS directory: <case>/LAMMPS/<file> (standard WashOpenFOAM convention).

  3. Case root directory: <case>/<file>.

  4. Current time directory: <case>/<time>/<file>.

  5. 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 include fileName, commandFile, and commandsFile.

Example Command Script#

Example of a coupling script (e.g., LAMMPS/in.liggghts_run):

# Advance DEM simulation using the exported coupling interval
run ${couplingInterval}

See Also#