cstar.roms.ROMSSimulation.build

Attention

This project is still in an early phase of development.

The python API is not yet stable, and some aspects of the schema for the blueprint and workplan will likely evolve. Therefore whilst you are welcome to try out using the package, we cannot yet guarantee backwards compatibility. We expect to reach a more stable version in 2026.

cstar.roms.ROMSSimulation.build#

ROMSSimulation.build(rebuild: bool = False) None#

Compile the ROMS executable from source code.

This method compiles the ROMS simulation based on the retrieved compile-time code and source files. The compilation process occurs in the working directory of compile_time_code. If the executable already exists and has not changed, it is not rebuilt unless explicitly requested with rebuild=True.

Parameters:

rebuild (bool, optional) – If True, forces recompilation even if the executable already exists and the source code has not changed. Default is False.

Raises:
  • ValueError – If compile_time_code is None or its working path is not set.

  • RuntimeError – If an error occurs during the compilation process.

Notes

  • This method first attempts to clean the build directory before compilation.

  • The compiled executable is stored in the exe_path attribute.

  • Compilation uses the system’s default compiler, which can be configured through cstar_sysmgr.environment.compiler.

Examples

>>> simulation.build()
Compiling UCLA-ROMS configuration...
UCLA-ROMS compiled at /path/to/build/directory
>>> simulation.build(rebuild=True)
Recompiling UCLA-ROMS...
Compilation complete.

See also

setup

Ensures necessary files are available before compilation.

run

Executes the compiled ROMS model.