% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/openfoam_docker.R
\name{run_openfoam_docker}
\alias{run_openfoam_docker}
\title{Run an OpenFOAM case via Docker}
\usage{
run_openfoam_docker(
  case_dir,
  image = "opencfd/openfoam-run:2506",
  ncpus = foam_default_ncpus(),
  wait = TRUE,
  quiet = FALSE
)
}
\arguments{
\item{case_dir}{Character. Absolute path to the OpenFOAM case directory.
Must contain an \code{Allrun} script (written by
\code{prepare_foam_case()}).}

\item{image}{Character. Docker image tag. Default
\code{"opencfd/openfoam-run:2506"}. Use the tag you pulled, e.g.
\code{"opencfd/openfoam-run:2406"} for an older version.}

\item{ncpus}{Integer. Number of CPU cores to use.  Defaults to all
physical cores detected on the host via
\code{parallel::detectCores(logical = FALSE)}.  When \code{ncpus > 1}
the solver runs in MPI parallel: \code{decomposePar} splits the mesh,
\code{mpirun -np ncpus solver -parallel} runs it, and
\code{reconstructPar} reassembles.  Typical speed-up is 3-6x on a
4-core machine.  Pass \code{ncpus = 1} to force single-core.}

\item{wait}{Logical. If TRUE (default), R blocks until the simulation
finishes. If FALSE, the container is launched in the background and the
function returns immediately.}

\item{quiet}{Logical. Suppress messages. Default FALSE.}
}
\value{
Invisibly returns a list with \code{case_dir}, \code{image}, and
the exit \code{status} (0 = success; only meaningful when
\code{wait = TRUE}).
}
\description{
Mounts the case directory into an OpenFOAM Docker container and executes
the \code{Allrun} script produced by \code{prepare_foam_case()}.
The generated wind case chains \code{blockMesh} -> \code{snappyHexMesh} ->
\code{buoyantBoussinesqPimpleFoam} and writes log files in
\code{case_dir}.

Docker Desktop must be running and the \code{case_dir} path must be under
a directory shared with Docker (Docker Desktop -> Settings -> Resources ->
File Sharing).
}
\seealso{
\code{\link{prepare_foam_case}}
}
